home *** CD-ROM | disk | FTP | other *** search
/ CD/PC Actual 76 / DVD Actual 1 Marzo 2003.iso / Trial / TurboCAD 7.1 Pro / Data.Cab / F29312_Begin.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-11-10  |  2.3 KB  |  100 lines

  1. // Begin.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "resource.h"
  6. #include "Begin.h"
  7. #include "PaperSpaceWizard.h"
  8.  
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CBegin property page
  17.  
  18. IMPLEMENT_DYNCREATE(CBegin, CPropertyPage)
  19.  
  20. CBegin::CBegin() : CPropertyPage(CBegin::IDD)
  21. {
  22.     //{{AFX_DATA_INIT(CBegin)
  23.         // NOTE: the ClassWizard will add member initialization here
  24.     //}}AFX_DATA_INIT
  25. }
  26.  
  27. CBegin::~CBegin()
  28. {
  29. }
  30.  
  31. void CBegin::DoDataExchange(CDataExchange* pDX)
  32. {
  33.     CPropertyPage::DoDataExchange(pDX);
  34.     //{{AFX_DATA_MAP(CBegin)
  35.         // NOTE: the ClassWizard will add DDX and DDV calls here
  36.     //}}AFX_DATA_MAP
  37. }
  38.  
  39.  
  40. BEGIN_MESSAGE_MAP(CBegin, CPropertyPage)
  41.     //{{AFX_MSG_MAP(CBegin)
  42.         // NOTE: the ClassWizard will add message map macros here
  43.     //}}AFX_MSG_MAP
  44. END_MESSAGE_MAP()
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CBegin message handlers
  48.  
  49. BOOL CBegin::OnSetActive() 
  50. {
  51.     
  52. //    CPropertySheet* pSheet = (CPropertySheet*)GetParent();
  53.     CPaperSpaceWizard* pSheet = (CPaperSpaceWizard*)GetParent();
  54.     ASSERT_KINDOF(CPropertySheet, pSheet);
  55. //    pSheet->SetWizardButtons(PSWIZB_NEXT);
  56.  
  57.     CEdit *pEdit = (CEdit *) GetDlgItem(IDC_EDITPSNAME);
  58.     pEdit->SetWindowText (pSheet->m_PSInfo->cstrPSpaceName);    
  59.     
  60.     return CPropertyPage::OnSetActive();
  61. }
  62.  
  63. LRESULT CBegin::OnWizardNext() 
  64. {
  65.     // TODO: Add your specialized code here and/or call the base class
  66.     HRESULT hRes = E_FAIL;    
  67.     CString cstrTmp;
  68.     CString cstrErr;
  69.     COleVariant varName;
  70.     varName.vt = VT_BSTR;
  71.     PaperSpace *pPs = NULL;
  72.  
  73.     try
  74.     {
  75.  
  76.         CPaperSpaceWizard* pSheet = (CPaperSpaceWizard*)GetParent();
  77.         CEdit *pEdit = (CEdit *) GetDlgItem(IDC_EDITPSNAME);
  78.         pEdit->GetWindowText(cstrTmp);
  79.         varName.bstrVal  = cstrTmp.AllocSysString ();
  80.         hRes = pSheet->m_pPss->get_Item(&varName, &pPs);
  81.         if(FAILED(hRes))
  82.         {
  83.             pSheet->m_PSInfo->cstrPSpaceName = cstrTmp;            
  84.             cstrTmp.Empty ();
  85.             return CPropertyPage::OnWizardNext();
  86.         }
  87.         cstrErr.LoadString (IDS_ERRDUPLICATEPS);
  88.         AfxMessageBox(cstrErr);
  89.         pEdit->SetFocus ();
  90.         pEdit->SetSel(0, strlen(cstrTmp), FALSE);
  91.  
  92.     }
  93.     catch(...)
  94.     {
  95.         TRACE("CBegin::OnWizardNext");    
  96.     }
  97.     RELEASE(pPs)
  98.     return CPropertyPage::OnSetActive();
  99. }
  100.